package com.example.mypro.controller;

import com.example.mypro.mapper.AddressMapper;
import com.example.mypro.pojo.entity.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/address/")
@RestController
public class AddressController {
    @Autowired
    private AddressMapper addressMapper;
    @RequestMapping("insert")
    public String insertAddress(Address address){
        addressMapper.insert(address);
        return "插入成功！";
    }
    @RequestMapping("delete")
    public String deleteAddress(int id){
        addressMapper.delete(id);
        return "删除成功";
    }
    @RequestMapping("select")
    public List<Address> selectAddress(){
        return addressMapper.select();
    }

}
